python programming and maching learning: Understanding how to code within 24hours with this simplified guide to programming and machine learning using python language(2 in 1) by Stance Movch

python programming and maching learning: Understanding how to code within 24hours with this simplified guide to programming and machine learning using python language(2 in 1) by Stance Movch

Author:Stance, Movch [Stance, Movch]
Language: eng
Format: epub
Published: 2021-03-05T00:00:00+00:00


Below is a good example

age = int(input("Enter your age:"))

if (age <=18):

print("You are not eligible for voting, try next election!")

print("Program closes")

This code will print you out a difference example based of the age that is placed in. Since it is an if statement in particular, you will find a solution exactly when the number is 18 or under. Here we will take a look at the output based on the age of 18 and that of 35.

Enter your age: 18

You are not qualified for voting, try next election!

Program ends

Enter your age: 35

Program closes

Presently we should investigate including various statements in your "if" statement. It isn't extraordinary to discover at least two statement being put inside an expression and working fine and dandy if everything is fulfilled. On the off chance that these statements are executed, you will need to ensure that you indent them appropriately. We should investigate how this could work. Ensure to check out this on your interpreter to get some knowledge in composing code and how the "if" statements are going to work.

bonus = 0.0

currentyear = int(input("Enter current year:"))

yearofjoining = int(input("Enter year of joining:"))

yearofservice = currentyear – yearofjoining

if(yearofservice >2):

reward = 1500

print("Bonus - %d" %bonus)

print("Congratulations! We can give you a reward o %d" %bonus).

Now if the "if" statement ends up being higher than two, you will find that the congrats statement is going to be displayed. However, in the event that the sum is lower than two, you are going to wind up without any statement since the entirety of the statements were not met. You can put whatever numbers that you need inside it so as to get it to work for each employee in this option.

The "if-else" Statement

So far we have recently been discussing the "if" statements. These are ones that should be true before any of your statement come out. On the off chance that things come out to be false, there will be no statement by any means. Now assuming you want to have different statements displayed then you will need the "if else" statement, you can pick two or more, statements that are going to come up dependent on the outcomes. On the off chance that your outcomes end up being true, you will have the first statement appear, however on the off chance that the outcomes wind up being false, you can pick another statement that you might want to appear also. This guarantees you are getting an answer regardless of the outcome with the goal that the program shows something new. You simply need to ensure that subsequent to working out your "if" statement, you include the "else" and afterward put in the statement that you might want to have displayed. This can take a touch of time to work, yet it opens up such a significant number of extraordinary options with your code to ensure that everything levels out and looks pleasant with your code.

The elif Statement

Another alternative that you can do with your statements is the elif statement. This one



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Popular ebooks
Whisky: Malt Whiskies of Scotland (Collins Little Books) by dominic roskrow(55920)
What's Done in Darkness by Kayla Perrin(26530)
Shot Through the Heart: DI Grace Fisher 2 by Isabelle Grey(19011)
The Fifty Shades Trilogy & Grey by E L James(18967)
Shot Through the Heart by Mercy Celeste(18885)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 10 by Isuna Hasekura and Jyuu Ayakura(16992)
Python GUI Applications using PyQt5 : The hands-on guide to build apps with Python by Verdugo Leire(16882)
Peren F. Statistics for Business and Economics...Essential Formulas 3ed 2025 by Unknown(16810)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 03 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16706)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 01 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16334)
The Subtle Art of Not Giving a F*ck by Mark Manson(14269)
The 3rd Cycle of the Betrayed Series Collection: Extremely Controversial Historical Thrillers (Betrayed Series Boxed set) by McCray Carolyn(14073)
Stepbrother Stories 2 - 21 Taboo Story Collection (Brother Sister Stepbrother Stepsister Taboo Pseudo Incest Family Virgin Creampie Pregnant Forced Pregnancy Breeding) by Roxi Harding(13435)
Scorched Earth by Nick Kyme(12718)
Drei Generationen auf dem Jakobsweg by Stein Pia(10926)
Suna by Ziefle Pia(10849)
Scythe by Neal Shusterman(10275)
International Relations from the Global South; Worlds of Difference; First Edition by Arlene B. Tickner & Karen Smith(9482)
Successful Proposal Strategies for Small Businesses: Using Knowledge Management ot Win Govenment, Private Sector, and International Contracts 3rd Edition by Robert Frey(9318)
This is Going to Hurt by Adam Kay(9109)